package com.wavehi.service.impl;

import com.wavehi.mapper.UserMapper;
import com.wavehi.pojo.User;
import com.wavehi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author WaveHi
 * @Date 18/10/2021 下午 3:42
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public Boolean addUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public Boolean addMultiUsers(List<Object[]> users) {
        return userMapper.batchInsert(users);
    }

    @Override
    public User getUser(Long id) {
        return userMapper.selectById(id);
    }

    @Override
    public String getUsername(Long id) {
        return userMapper.selectByIdForUsername(id);
    }

    @Override
    public List<User> getAllUser() {
        return userMapper.selectAll();
    }
}
